import 'package:flutter/material.dart';
import 'package:jspang/model/category.dart';

class ChildCategory with ChangeNotifier {
  List<BxMallSubDto> childCategoryList = [];

  int childIndex = 0; //子类高亮索引

  String categoryId = '4'; //大类的id
  String subId = ''; //小类id
  int page = 1; //列表页数
  String noMoreText = ''; //显示没有数据的文字
  ChildCategory(BuildContext context);
  //大类切换
  getChildCategory(List<BxMallSubDto> list, String id) {
    childIndex = 0;
    page = 1;
    noMoreText = '';
    categoryId = id;
    BxMallSubDto all = BxMallSubDto();
    all.mallSubId = "";
    all.mallCategoryId = "4";
    all.comments = "null";
    all.mallSubName = "全部";
    childCategoryList = [all];
    childCategoryList.addAll(list);
    // childCategoryList = list;
    notifyListeners();
  }

  //改变子类索引
  changechildIndex(index, String id) {
    page = 1;
    noMoreText = '';
    childIndex = index;
    subId = id;
    notifyListeners();
  }

  //增加page的方法
  addPage() {
    page++;
    // notifyListeners();
  }

  changeNoMoreText(String text) {
    noMoreText = text;
    notifyListeners();

  }
}
